package com.oracle.controller;

import com.oracle.common.PageResult;
import com.oracle.common.R;
import com.oracle.pojo.Ssws;
import com.oracle.service.SswsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("ssws")
public class SswsController {

    @Autowired
    private SswsService sswsService;

    @GetMapping("find")
    public List<Ssws> findList()
    {
        List<Ssws> list = sswsService.findList();
        return list;
    }

    @PostMapping("find2")
    public R<Ssws> findPages2(@RequestBody Ssws ssws, Integer pageNo, Integer pageSize)
    {
        if(ObjectUtils.isEmpty(pageNo)){
            pageNo = 1;
        }

        if(ObjectUtils.isEmpty(pageSize)){
            pageSize = 10;
        }

        PageResult pages = sswsService.findPages(pageNo, pageSize,ssws);
        return R.success(pages);
    }
}
